package org.dromara.common.core.domain.dto

import java.io.Serial
import java.io.Serializable
import java.util.*

/**
 * 办理任务请求对象
 *
 * @author LikeYouDo
 * @date 2025/09/22
 */
data class CompleteTaskDTO(
    /**
     * 任务id
     */
    var taskId: Long? = null,

    /**
     * 附件id
     */
    var fileId: String? = null,

    /**
     * 抄送人员
     */
    var flowCopyList: MutableList<FlowCopyDTO>? = null,

    /**
     * 消息类型
     */
    var messageType: MutableList<String?>? = null,

    /**
     * 办理意见
     */
    var message: String? = null,

    /**
     * 消息通知
     */
    var notice: String? = null,

    /**
     * 办理人(可不填 用于覆盖当前节点办理人)
     */
    var handler: String? = null,

    /**
     * 扩展变量(此处为逗号分隔的ossId)
     */
    var ext: String? = null

) : Serializable {
    companion object {
        @Serial
        private const val serialVersionUID = 1L
    }

    /**
     * 流程变量
     */
    var variables: MutableMap<String, Any?>? = null
        get() {
            if (field === null) {
                return HashMap(16)
            }
            field!!.entries.removeIf { entry -> entry.value == null }
            return field
        }

}
